package com.ljfiction.book.adapter;

import android.graphics.Color;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ljfiction.book.Baner.AddBookBean;
import com.ljfiction.book.MyView.SuperButton;
import com.ljfiction.book.R;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;


/**
 * @author zjc
 */
public class PlotLableAdapter extends BaseQuickAdapter<AddBookBean.DataBean.BooklablesListBean,BaseViewHolder> {


    public PlotLableAdapter(@LayoutRes int layoutResId, @Nullable List<AddBookBean.DataBean.BooklablesListBean> data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, AddBookBean.DataBean.BooklablesListBean item) {
        AutoUtils.autoSize(helper.itemView);
        if (item.isCleck()) {
            ((SuperButton)helper.getView(R.id.table_item)).setsSolidColor(item.getBookColor());
            ((SuperButton)helper.getView(R.id.table_item)).setStrokeColor(Color.parseColor("#00000000"),1);
           helper.setTextColor(R.id.table_item,Color.parseColor("#ffffff"));
        } else {
            ((SuperButton)helper.getView(R.id.table_item)).setsSolidColor("#ffffff");
            ((SuperButton)helper.getView(R.id.table_item)).setStrokeColor(Color.parseColor("#8C8C8C"),1);
            helper.setTextColor(R.id.table_item,Color.parseColor("#333333"));
        }
        helper.setText(R.id.table_item,item.getBookLableName());
        helper.addOnClickListener(R.id.table_item);
    }


}
